package com.gdut.simple.view.activity.user;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.Toast;

import com.gdut.simple.R;
import com.gdut.simple.common.ToastUtils;
import com.gdut.simple.view.basic.AbsBasicActivity;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class AboutActivity extends AbsBasicActivity {

    @BindView(R.id.id_toolbar)
    Toolbar mToolbar;

    @OnClick(R.id.id_check_update_button)
    void checkUpdate() {
        showProgress("检查更新中...");
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                hideProgress();
                ToastUtils.showShort(AboutActivity.this, "已经是最新版本");
            }
        }, 1500);
    }

    @OnClick(R.id.id_feedback_button)
    void gotoFeedback() {
        startActivity(new Intent(AboutActivity.this, FeedbackActivity.class));
    }

    @OnClick(R.id.id_copyright_button)
    void gotoCopyright() {
        startActivity(new Intent(AboutActivity.this, CopyrightActivity.class));
    }

    @OnClick(R.id.id_user_protocol_button)
    void gotoProtocol() {
        startActivity(new Intent(AboutActivity.this, ProtocolActivity.class));
    }

    @OnClick(R.id.id_about_us_button)
    void gotoAboutUs() {
        startActivity(new Intent(AboutActivity.this, AboutUsActivity.class));
    }

    @Override
    protected void initView(Bundle savedInstanceState) {
        setContentView(R.layout.activity_about);
        ButterKnife.bind(this);
        initToolbar();
    }

    private void initToolbar() {
        mToolbar.setTitle("关于");
        setSupportActionBar(mToolbar);
        if (getSupportActionBar() != null) {
            getSupportActionBar().setDisplayHomeAsUpEnabled(true);
            mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    finish();
                }
            });
        }
    }

}
